package com.atguigu.demo.customer.mapper;

import com.atguigu.demo.customer.bean.Customer;
import org.apache.ibatis.annotations.*;

import java.util.List;

@Mapper
public interface CustomerMapper {

    @Insert("insert into  customer(id,name,age) values(#{customer.id},#{customer.name},#{customer.age})")
    public void insertCustomer(@Param("customer") Customer customer);

    @Select("select * from customer where id = #{id}")
    public Customer selectCustomerById(Long id);

    @Select("select * from customer where name = #{name}")
    public List<Customer> selectCustomerByName(String name);

    @Update("update customer set name=#{customer.name} where id=#{customer.id}")
    public void updateCustomer(@Param("customer")  Customer customer);

    @Delete("delete from customer where id=#{id}")
    public void deleteCustomer(Long id);

}
